<?php

class user extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->library('session');
        $this->load->model('connect');
        $this->load->helper("url");
        $this->load->helper("date");
        $this->load->database();
    }

    function uploadavarta() {
        if (!empty($_FILES)) {
            $tempFile = $_FILES['avarta']['tmp_name'];
            $targetPath = $_SERVER['DOCUMENT_ROOT'] . '/nfa/images/avarta/';
            $targetFile = $targetPath . $_FILES['avarta']['name'];
            move_uploaded_file($tempFile, $targetFile);
            $data = array(
                'avarta' => $_FILES['avarta']['name']
            );
            $this->db->where('user_id', $this->session->userdata('id'));
            $this->db->update('users', $data);
           header("Location: http://localhost:8080/nfa/index.php/home/mypage");
        }
    }
    
    function updatestt(){
         $data = array(
                'status' => $_POST['stt']
            );
            $this->db->where('user_id', $this->session->userdata('id'));
            $this->db->update('users', $data);
            header("Location: http://localhost:8080/nfa/index.php/home/mypage");
    }

}

?>
